Skip to content

Record snapshots in FunctionRecorder with context information#928

Merged
marcoeilers merged 3 commits into
masterfrom
meilers_funcrec_fix
Jun 13, 2025
Merged

Record snapshots in FunctionRecorder with context information#928
marcoeilers merged 3 commits into
masterfrom
meilers_funcrec_fix

Conversation

@marcoeilers

@marcoeilers marcoeilers commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

In particular, remember if snapshots were recorded inside let-expressions or quantifiers, since this can influence the value of the expression and the validity of the guard terms.

We do this by adding a stack of ExpContexts to the mapping in the FunctionRecorder, which represents the stack of lets and quantifiers inside which an expression's snapshot was recorded. The ExpressionTranslator used to translate function axioms maintains the same kind of stack and looks up expressions in the current context.

This fixes #715 and #926.

@marcoeilers marcoeilers marked this pull request as ready for review June 13, 2025 14:26
@marcoeilers marcoeilers requested a review from Copilot June 13, 2025 15:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds context tracking for expression snapshots in the FunctionRecorder and its related translation to correctly handle nested contexts in let‐expressions and quantifiers. Key changes include:

  • Introducing a stack of ExpContext in HeapAccessReplacingExpressionTranslator to record let/quantifier scopes.
  • Updating the key types in snapshot maps in FunctionRecorder and FunctionData to include context information.
  • Adjusting evaluator code to properly push and pop context when evaluating let and quantified expressions.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/scala/supporters/functions/HeapAccessReplacingExpressionTranslator.scala Adds context management and updates getOrFail to use context.
src/main/scala/supporters/functions/FunctionRecorder.scala Integrates context tracking into snapshot recording and adds helper methods to manage the context stack.
src/main/scala/supporters/functions/FunctionData.scala Updates snapshot maps to include context info and adapts call sites accordingly.
src/main/scala/rules/Evaluator.scala Adjusts let & quantifier evaluation to enter and leave the new context.
silver Updates subproject commit.
Comments suppressed due to low confidence (1)

src/main/scala/supporters/functions/FunctionRecorder.scala:171

  • [nitpick] Consider adding a comment clarifying the rationale for using the current '_context' as part of the key when recording snapshots. This can help future maintainers understand why the snapshot is tied to the full context state.
val guardsToSnaps = recordings.getOrElse((loc, _context), InsertionOrderedSet()) + (guards -> snap)

@marcoeilers marcoeilers merged commit d27a6c9 into master Jun 13, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash due to "unknown constant"

2 participants